package cn.pomit.springbootwork.zipkin.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;

import cn.pomit.springbootwork.zipkin.model.ResultModel;

@Service
public class IpInfoService {
	/**
	 * 第一个consulServer是配置文件种的spring.application.name,第二个是controller中配置的路径
	 */
	public static String remoteIpServiceUrl = "http://consulClient/consulClient/ip";
	@Autowired
	private RestTemplate restTemplate;

	public ResultModel getIpInfo() {
		ResponseEntity<ResultModel> ipModel = restTemplate.getForEntity(remoteIpServiceUrl, ResultModel.class);
		return ipModel.getBody();
	}
}
